package com.imti.mall.order.controller;

import com.imti.mall.common.Api.CommonResult;
import com.imti.mall.model.oms.pojo.OmsOrderSetting;
import com.imti.mall.order.service.OrderSettingService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@Api(tags="订单设置")
@RequestMapping("/api/v1/orderSetting")
public class OrderSettingController {

    @Resource
    private OrderSettingService orderSettingService;
    @GetMapping("/getSetting")
    public CommonResult getOrderSetting(){
         OmsOrderSetting orderSetting=orderSettingService.getOrderSetting();
         orderSetting.getFlashOrderOvertime();//秒杀订单超时关闭时间
        return CommonResult.success(orderSetting);
    }

    @PostMapping("/setting")
    public CommonResult updateOrderSetting(OmsOrderSetting omsOrderSetting){

        int n=orderSettingService.updateOrderSetting(omsOrderSetting);

        return CommonResult.success(n>0);
    }

}
